package cn.stylefeng.guns.modular.business.mapper;

import cn.stylefeng.guns.modular.business.entity.BatchOrder;
import cn.stylefeng.guns.modular.business.model.params.BatchOrderParam;
import cn.stylefeng.guns.modular.business.model.params.BatchOrderQueryParam;
import cn.stylefeng.guns.modular.business.model.result.BatchOrderResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 批次订单 Mapper 接口
 * </p>
 *
 * @author jwj
 * @since 2019-09-09
 */
@Repository
public interface BatchOrderMapper extends BaseMapper<BatchOrder> {

    /**
     * 获取列表
     *
     * @author jwj
     * @Date 2019-09-09
     */
    List<BatchOrderResult> customList(@Param("paramCondition") BatchOrderParam paramCondition);


    /**
     * 分页获取我的批量订单
     *
     * @param page                 分页对象
     * @param batchOrderQueryParam 批量查询参数
     * @return
     */
    Page<BatchOrderResult> getMyBatchOrders(@Param("page") Page page, @Param("batchOrderQueryParam") BatchOrderQueryParam batchOrderQueryParam);

    /**
     * 减1处理中的订单数量，同时加上1个成功数量，失败数量
     *
     * @return
     */
    int decrDoingNum(@Param("successNum") Integer successNum, @Param("failNum") Integer failNum, @Param("batchId") Integer batchId);

    /**
     * 获取map列表
     *
     * @author jwj
     * @Date 2019-09-09
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") BatchOrderParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author jwj
     * @Date 2019-09-09
     */
    Page<BatchOrderResult> customPageList(@Param("page") Page page, @Param("paramCondition") BatchOrderParam paramCondition);

    /**
     * 获取分页map列表
     *
     * @author jwj
     * @Date 2019-09-09
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") BatchOrderParam paramCondition);

}
